

#include "Test.h"

#if TEST_KeyBoard
#include <string.h>
#include "Led.h"
#include "KeyBoard.h"
#include "BSP_Keyboard.h"
#include "BSP_Delay.h"
#include "Debug.h"

extern volatile KeyValue_T keyValue;

void TestKeyBoard(void){
	int key;
	DBG_WRITE("Key Board:\r\n");
//		BSP_Keyboard_Init();
	while(1){
		if(keyValue.flag == 1){
			keyValue.flag = 0;
			int i;
			for(i = 0; i < 3; i++){
				BSP_Delay_ms(10);
				key = BSP_Keyboard_Scan();
				if(key >= 0){
					keyValue.value = key;
					keyValue.flag = 2;
					break;
				}
			}
		}
		if(keyValue.flag == 2){
			keyValue.flag = 0;
			DBG_PRINT("Key: %X\r\n", keyValue.value);
		}
	}
}
#endif 


